package com.tv.cms.system.account.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.tv.cms.system.account.model.Account;
import com.tv.cms.system.account.service.AccountService;
import com.tv.cms.system.role.model.Role;
import com.tv.cms.utils.InitPassword;
import com.tv.cms.utils.Md5encrypt;
import com.tv.cms.utils.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * TODO
 *
 * @author
 * @date
 **/
@RestController
@RequestMapping("user")
public class AccountController {
    @Resource
    private AccountService service;
    /**
     * 用户信息
     *
     * @param account
     * @return
     */
    @PostMapping("list")
    public Result<List<Account>> list(@RequestBody Account account){
        return  null;
    }

    /**
     * 添加用户
     * @param account
     * @return
     */
    @PostMapping("save")
    public Result save(@RequestBody Account account){
        return null;
    }

    /**
     * 更新用户状态
     * @param account
     * @return
     */
    @PutMapping("status")
    public Result status(@RequestBody Account account){
        if(account.getStatus() == null || account.getId() == null){
            return Result.FAILURE(400,"参数错误");
        }
        Account a = new Account();
        a.setStatus(account.getStatus());
        a.setId(account.getId());
        boolean b = service.updateById(a);
        return b ? Result.OK() : Result.FAILURE();
    }


}
